﻿
<%@ Page Language="C#"  MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true"  CodeFile="AfiDetail.aspx.cs" Inherits="AfiDetail" Title="AfiDetail List" %>

<asp:Content ID="Content2" ContentPlaceHolderID="TitleContent" Runat="Server">Afi Detail List</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentContent" Runat="Server">
		<data:GridViewSearchPanel ID="GridViewSearchPanel1" runat="server" GridViewControlID="GridView1" PersistenceMethod="Session" />
		<br />
		<data:EntityGridView ID="GridView1" runat="server"			
				AutoGenerateColumns="False"					
				OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
				DataSourceID="AfiDetailDataSource"
				DataKeyNames="LineItem"
				AllowMultiColumnSorting="false"
				DefaultSortColumnName="" 
				DefaultSortDirection="Ascending"	
				ExcelExportFileName="Export_AfiDetail.xls"  		
			>
			<Columns>
				<asp:CommandField ShowSelectButton="True" ShowEditButton="True" />				
				<data:HyperLinkField HeaderText="Afi Code" DataNavigateUrlFormatString="AfiEdit.aspx?AfiCode={0}" DataNavigateUrlFields="AfiCode" DataContainer="AfiCodeSource" DataTextField="ClientName" />
				<data:HyperLinkField HeaderText="Product Code" DataNavigateUrlFormatString="ProductEdit.aspx?ProductCode={0}" DataNavigateUrlFields="ProductCode" DataContainer="ProductCodeSource" DataTextField="ProductDescription" />
				<data:HyperLinkField HeaderText="Unit" DataNavigateUrlFormatString="UnitTableEdit.aspx?UnitCode={0}" DataNavigateUrlFields="UnitCode" DataContainer="UnitSource" DataTextField="UnitDescrption" />
				<asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="[Quantity]"  />
				<asp:BoundField DataField="UnitCost" HeaderText="Unit Cost" SortExpression="[UnitCost]"  />
				<asp:BoundField DataField="CoverPeriodFrom" DataFormatString="{0:d}" HtmlEncode="False" HeaderText="Cover Period From" SortExpression="[CoverPeriodFrom]"  />
				<asp:BoundField DataField="CoverPeriodTo" DataFormatString="{0:d}" HtmlEncode="False" HeaderText="Cover Period To" SortExpression="[CoverPeriodTo]"  />
			</Columns>
			<EmptyDataTemplate>
				<b>No AfiDetail Found!</b>
			</EmptyDataTemplate>
		</data:EntityGridView>
		<br />
		<asp:Button runat="server" ID="btnAfiDetail" OnClientClick="javascript:location.href='AfiDetailEdit.aspx'; return false;" Text="Add New"></asp:Button>
		<data:AfiDetailDataSource ID="AfiDetailDataSource" runat="server"
			SelectMethod="GetPaged"
			EnablePaging="True"
			EnableSorting="True"
			EnableDeepLoad="True"
			>
			<DeepLoadProperties Method="IncludeChildren" Recursive="False">
	            <Types>
					<data:AfiDetailProperty Name="Afi"/> 
					<data:AfiDetailProperty Name="Product"/> 
					<data:AfiDetailProperty Name="UnitTable"/> 
				</Types>
			</DeepLoadProperties>
			<Parameters>
				<data:CustomParameter Name="WhereClause" Value="" ConvertEmptyStringToNull="false" />
				<data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
				<asp:ControlParameter Name="PageIndex" ControlID="GridView1" PropertyName="PageIndex" Type="Int32" />
				<asp:ControlParameter Name="PageSize" ControlID="GridView1" PropertyName="PageSize" Type="Int32" />
				<data:CustomParameter Name="RecordCount" Value="0" Type="Int32" />
			</Parameters>
		</data:AfiDetailDataSource>
	    		
</asp:Content>



